from django.core.mail import send_mail

from boxuegu import settings


def send_reset_email(email, reset_url):

    # email: 收件人邮箱 verify_url: 验证链接

    # subject 邮件标题
    # message 普通邮件正文，普通字符串
    # from_email 发件人
    # recipient_list 收件人列表
    # html_message 多媒体邮件正文，可以是html字符串

    subject = "博学谷重置密码"
    message = ""
    from_email = settings.EMAIL_FROM
    recipient_list = [email]
    html_message = '<p>您的邮箱为：%s 。请点击此链接进行密码修改：</p>' \
                   '<p><a href="%s">%s<a></p>' % (email, reset_url, reset_url)

    try:
        send_mail(subject,message,from_email,recipient_list,html_message=html_message)
    except Exception as e:
        print(e)
